package com.mo.axion.support.dao;

import com.mo.axion.support.domain.MessageTemplate;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * @author Mo
 * @createTime 2024/1/24 0:33
 * @descripiton 消息模板Dao
 */
public interface MessageTemplateDao extends JpaRepository<MessageTemplate, Long>, JpaSpecificationExecutor<MessageTemplate> {
    /**
     * 查询 分页
     * @param deleted 1: 未删除 0: 已删除
     * @param pageable 分页对象
     * @return
     */
    List<MessageTemplate> findAllByIsDeletedEqualsOrderByUpdatedDesc(Integer deleted, Pageable pageable);

    /**
     * 统计未删除的消息条数
     * @param deleted 1: 未删除 0: 已删除
     * @return 返回未删除的消息条数
     */
    Long countByIsDeletedEquals(Integer deleted);
}
